import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: () => import('../views/Index.vue'),
    children: [
      {
        path: '/index',
        redirect: '/home'
      },
      {
        path: '/home',
        component: () => import('../views/son/Home.vue')
      },
      {
        path: '/discuss',
         component: () => import('../views/son/Discuss.vue')
      },
      {
        path: '/car',
         component: () => import('../views/son/Car.vue')
      },
      {
        path: '/city',
         component: () => import('../views/son/City.vue')
      },
      {
        path: '/my',
         component: () => import('../views/son/My.vue')
      }
    ]
  },
  {
    path: '/detail/:i/:index',
    component: () => import('../views/Detail.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
